using System;
using System.Globalization;
using System.Windows.Data;

namespace PCR.Converter
{
    public class MutilDoubleConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            double result = 0.0;
            double.TryParse(values[0].ToString(), out result);
            double result2 = 0.0;
            double.TryParse(values[1].ToString(), out result2);
            result2 = ((!(result2 < 80.0)) ? (result2 - 80.0) : 1.0);
            return (99.0 - result) / 95.0 * result2 + 40.0;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
